package com.bac.rentmap.configuration;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class ConfigurationProperty {
    private static final String NAME_SEPARATOR = "/";

    @SuppressWarnings("unused")
	@PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private String name;
    @Persistent
    private String value;

    public ConfigurationProperty(String name, String... nameExtentions) {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(name);
        
        for (String string : nameExtentions) {
        	stringBuilder.append(NAME_SEPARATOR);
            stringBuilder.append(string);
        }
        this.name = stringBuilder.substring(0, stringBuilder.length() - 1).toString();

    }

    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
}
